package org.oak.config;

import org.apache.dubbo.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * org.oak.config.ProjectNacosNameConfig
 *
 * @author ZRS
 * @version V1.0
 * @since 2025/10/30 01:34
 */
@Configuration
public class ProjectNacosNameConfig implements EnvironmentAware {

    @Value("${dubbo.application.name}")
    private String projectName;

    @Override
    public void setEnvironment(Environment environment) {
        // 问题：nacos2 订阅列表应用名unknown问题 解决
        if (StringUtils.isBlank(System.getProperty("project.name"))) {
            System.setProperty("project.name", projectName);
        }
    }
}
